package com.translation.utils;

import java.io.UnsupportedEncodingException;

import org.apache.commons.codec.binary.Base64;

public class Encrypt {
	private static Base64 base64 = new Base64(true);
	
	public static String encode(String str){
		return base64.encodeAsString(str.getBytes());
	}
	
	public static String decode(String str){
		byte[] strByte =  base64.decode(str);
		try {
			return new String(strByte,"UTF-8");
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		}
		return null;
	}
}
